﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Diagnostics;

namespace Microsoft.WPF.Samples
{

    /// <summary>
    /// This converter does nothing except breaking the
    /// debugger into the convert method to help us debugging Binding Expressions in XAML.
    /// Because Syncronisation and Conversation is running parralel on 
    /// binding Expressions we can take a look into the Binding Values.
    /// 
    /// Sample of using this Binding Debugger: 
    /// <TextBlock Text="{Binding ElementName=stack, Converter={StaticResource DatabindingDebugConverter}}" />
    /// </summary>
    class DatabindingDebugConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Debugger.Break();
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Debugger.Break();
            return value;
        }

        #endregion
    }
}
